package com.trendit.print.sdk.models.printer;

import com.alibaba.fastjson.JSON;
import com.trendit.print.sdk.DaquObject;
import com.trendit.print.sdk.DaquRequest;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 绑定打印机请求
 */
public class AddPrinterRequest implements DaquRequest<AddPrinterResponse> {

    private String bizContent;

    /**
     * 构造方法
     */
    public AddPrinterRequest(List<AddPrinterRequest.Model> modelList) {
        this.bizContent = JSON.toJSONString(modelList);
    }

    @Override
    public String getApiMethodName() {
        return "openapi.addPrinter";
    }

    @Override
    public String getApiVersion() {
        return "1.0";
    }

    @Override
    public String getNotifyUrl() {
        return null;
    }

    @Override
    public String getApiMethodURL() {
        return "/openapi/add_printer";
    }

    @Override
    public Class<AddPrinterResponse> getResponseClass() {
        return AddPrinterResponse.class;
    }

    @Override
    public DaquObject getBizModel() {
        return null;
    }

    @Override
    public String getBizContent() {
        return bizContent;
    }

    @Data
    public static class Model extends DaquObject {
        /**
         * 设备编号
         */
        @NotBlank(message = "设备编号不能为空")
        private String sn;

        /**
         * 设备激活码（打印机背面二维码值）
         */
        @NotNull(message = "设备激活码不能为空")
        private String key;

        /**
         * 设备名称
         */
        private String name;

        /**
         * 设备语言
         */
        private Integer lang = 16;
    }
}
